<template>
	<view class="wrapForm">
		<view class="bgLine flex jst-between pL25 pR25">
		</view>
		<view class="wrapFormBody pL15 pR15 pT15 rzBox">
			<view>
				<text class="font24">{{current===0?'基本用工需求':'完善用工需求'}}</text>
				<text class="pL5 font16">{{current+1}}/2</text>
			</view>

			<u-form v-show="current==0" :label-style="{'font-size':'30rpx'}" class="xf-wrap-form" ref="dataForm"
				:rules="rules" :model="formData" :error-type="['toast']">
				<u-form-item :border-bottom="false" :label-position="'top'" :required="true" label="招工类型"
					prop="oddJobTypeText">
					<view class="w100  font14 inpuTBg">
						<u-input class="w100" @click="openJobType" type="select" :placeholder="'请选择招工类型'"
							v-model="formData.oddJobTypeText"></u-input>
					</view>
				</u-form-item>
				<u-form-item :required="true" :border-bottom="false" label="工作名称" :label-position="'top'"
					prop="oddJobName">
					<view class="w100 flex  font14 inpuTBg">
						<u-input class="w100" placeholder="请输入工作名称" v-model="formData.oddJobName" />
					</view>

				</u-form-item>

				<view class="flex jst-between" :border-bottom="false">
					<view class="w50 mR10">
						<u-form-item :border-bottom="false" :label-position="'top'" :required="true" label="用工工期"
							prop="jobBeginTime">
							<view class="w100 flex  font14 inpuTBg">
								<u-input type="select" @click="showStartDate=jobId?false:true" v-model="formData.jobBeginTime"
									placeholder="请选择开始日期"></u-input>

							</view>
						</u-form-item>
					</view>
					<view class="w50 mL10">
						<u-form-item class="hidLabel" :label-style="{color:'#fff'}" :label-position="'top'"
							:border-bottom="false" label="11" prop="jobEndTime">
							<view class="w100 flex  font14 inpuTBg">
								<u-input @click="showEndDate=jobId?false:true" type="select" v-model="formData.jobEndTime"
									placeholder="请选择结束日期"></u-input>

							</view>
						</u-form-item>
					</view>
				</view>
				<view class="flex jst-between" :border-bottom="false">
					<view class="w50 mR10">
						<u-form-item :border-bottom="false" :label-position="'top'" :required="true" label="工作时间"
							prop="jobBeginDatetime">
							<view class="w100 flex  font14 inpuTBg">
								<u-input @click="showStartTime=true" type="select" v-model="formData.jobBeginDatetime"
									placeholder="请选择开始时间"></u-input>

							</view>
						</u-form-item>
					</view>
					<view class="w50 mL10">
						<u-form-item class="hidLabel" :label-style="{color:'#fff'}" :label-position="'top'"
							:border-bottom="false" label="11" prop="jobEndDatetime">
							<view class="w100 flex  font14 inpuTBg">
								<u-input type="select" v-model="formData.jobEndDatetime" placeholder="请选择结束时间"
									@click="showEndTime=true"></u-input>

							</view>
						</u-form-item>
					</view>
				</view>

				<view class="flex jst-between" :border-bottom="false">
					<view class="w100">
						<u-form-item :border-bottom="false" :label-position="'top'" :required="true" label="薪资"
							prop="salary">
							<view class="w100 flex  font14 inpuTBg">
								<view class="w90"><u-input :disabled="isCurrentPosition" placeholder="请输入薪资" v-model.trim="formData.salary" @blur="onblur($event)"></u-input></view>
								<view>/天</view>
							</view>
							<view v-if="averageSalary" class="salaryInfo">温馨提示：根据系统评估，该职位的平均薪资为{{averageSalary}}，建议 最低薪资不低于此才有一定竞争力。</view>
						</u-form-item>
					</view>
				</view>
				<u-form-item :border-bottom="false" :required="true" label="结算方式" :label-position="'top'" prop="salaryPayment">
					<view class="w100  font14 inpuTBg">
						<xfSelect inputAlign="left" class="w100" :key="1" @change="changeSettle" :options="salaryPaymentLis" v-model="formData.salaryPayment"></xfSelect>
					</view>
				</u-form-item>
				<u-form-item :border-bottom="false" :required="true" label="工作地址" :label-position="'top'"
					prop="address">
					<view class="w100 flex alg-center jst-between inpuTBg">
						<view class="w70"><u-input :disabled="true" placeholder="请选择工作地址" v-model="formData.address" />
						</view>
						<image @click="chooseLocation" class="imgW36" :src="resources.posIcon" mode=""></image>
					</view>
				</u-form-item>
				<u-form-item label="详细地址" :required="true" :border-bottom="false" :label-position="'top'"
					prop="hopeWorkAddress">
					<view class="w100  inpuTBg">
						<u-input class="w100" placeholder="请输入详细地址" v-model.trim="formData.hopeWorkAddress" />
					</view>
				</u-form-item>
				<u-form-item :border-bottom="false" :required="true" label="联系人" :label-position="'top'" prop="contact">
					<view class="w100 flex alg-center jst-between inpuTBg">
						<u-input placeholder="请输入联系人" v-model.trim="formData.contact" />
						<!-- #ifdef MP-COMPANY -->
						<!-- 企业端发布职位可以选择联系人 -->
						<view @click="openPhoenLink"><u-icon name="arrow-down-fill" color="#8d8d8d"></u-icon></view>
						<!-- #endif -->

					</view>
				</u-form-item>
				<u-form-item :border-bottom="false" :required="true" label="联系电话" :label-position="'top'"
					prop="contactPhone">
					<view class="w100 flex alg-center jst-between inpuTBg">
						<u-input placeholder="请输入联系电话" v-model="formData.contactPhone" />
					</view>
				</u-form-item>
			</u-form>



			<u-form v-show="current==1" :error-type="['toast']" :label-style="{'font-size':'30rpx'}"
				class="xf-wrap-form nextForm" ref="nextForm" :rules="nextRules" :model="formData">
				<u-form-item :border-bottom="false" :required="true" label="职位描述" :label-position="'top'"
					prop="oddJobDescribe">
					<u-input
						:custom-style="{background:'#F8F8F8',borderRadius:'20rpx',padding:'30rpx 30rpx !important'}"
						:placeholderStyle="'margin-left:24rpx;color:#8d8d8d'" class="textPz" type="textarea"
						placeholder="请详细描述您需要补充的内容" v-model="formData.oddJobDescribe" />
				</u-form-item>
				<u-form-item :border-bottom="false" :required="true" label="招聘人数" :label-position="'top'"
					prop="oddJobUseNum">
					<view class="w100 flex flex-wrap ">
						<view v-if="!isCurrentPosition" :class="v.checked==true?'checked':''" class="typeItem"
							@click.stop="checkType('oddJobUseNum',v,z)" v-for="(v,z) in oddJobUseNumLis"
							:key="'oddJobUseNum'+v.value">
							{{v.text}}
						</view>
						<block v-else>
							<view :class="v.checked==true?'checked-disabled':''" class="typeItem"
								v-for="(v,z) in oddJobUseNumLis"
								:key="'oddJobUseNum'+v.value">
								{{v.text}}
							</view>
						</block>
						<view class="typeItem typeItemInput" :class="isFocus?'checked':''">

							<u-input @focus="focus" :disabled="jobId" :input-align="'center'" placeholder="自定义" @input="inputNumber"
								:border="false" v-model="jobNum"></u-input>
						</view>
					</view>
				</u-form-item>
				<u-form-item :required="true" :border-bottom="false" label="自带工具" :label-position="'top'"
					prop="izTools">
					<view class="w100 flex flex-wrap ">
						<view :key="'izTools'+i" :class="v.checked==true?'checked':''" class="typeItem"
							@click="checkType('izTools',v,i)" v-for="(v,i) in izToolsLis">
							{{v.text}}
						</view>
					</view>
				</u-form-item>
				<u-form-item :required="true" :border-bottom="false" label="工作方式" :label-position="'top'"
					prop="workWay">
					<view class="w100 flex flex-wrap ">
						<view :key="i+'workWay'" :class="v.checked==true?'checked':''" class="typeItem"
							@click="checkType('workWay',v,i)" v-for="(v,i) in workWayLis">
							{{v.text}}
						</view>
					</view>
				</u-form-item>
				<view class="font15">用工保障</view>
				<view class="flex jst-between w100 mT10" v-for="(item,i) in zzfwLis" :key="i">
					<view>
						<view class="font15">{{item.name}}</view>
						<view class="font13 u-8bd mT5">{{item.described}}</view>
					</view>
					<view class="flex alg-center">
						<view class="u-red font15 mR5">￥{{item.salary}}</view>
						<u-checkbox :name="item.pseudonym" v-model="item.checked"
							@change="checkZzfw($event,i)"></u-checkbox>
					</view>
				</view>
				<view>
					<view class="mT10 mB5 font15" style="color: #f8cac6;">职位发布须知</view>
					<u-parse :html="agreement"></u-parse>
				</view>
				<view class="mT10 u-org font13">温馨提示：职位发布一个月自动下架</view>
			</u-form>


		</view>
		<block v-if="current==0">
			<view class="flex jst-center mT20 bottomW bgf">
				<view class="pointer rightNowPay u-f font15 t-center" @click="nextStep">
					下一步
				</view>
			</view>
		</block>
		<block v-else>
			<view class="flex jst-center mT20 bottomW bgf">
				<view class="returnBack font16 u-blue" @click="nextStep">
					返回上一步
				</view>
				<view class="publishBtn font16 u-f mL15" @click="addPub">
					发布职位
				</view>
			</view>
		</block>
		<jobType ref="jobType" @getSelV="getSelV" :defaultValue="formData.oddJobType"></jobType>
		<phoneSel @updateSelV="getConact" ref="phoneSel" :defaultValue="formData.contact"></phoneSel>
		<u-picker :default-time="formData.jobBeginTime" :params="{year: true,month: true,day: true}"
			v-model="showStartDate" mode="time" @confirm="setStartDate"></u-picker>
		<u-picker :default-time="formData.jobEndTime" :params="{year: true,month: true,day: true}" v-model="showEndDate"
			mode="time" @confirm="setEndDate"></u-picker>
		<u-picker :default-time="formData.jobBeginDatetime"
			:params="{year: false,month: false,day: false,hour:true,minute:true}" v-model="showStartTime" mode="time"
			@confirm="setStartTime"></u-picker>
		<u-picker :default-time="formData.jobEndDatetime"
			:params="{year: false,month: false,day: false,hour:true,minute:true}" v-model="showEndTime" mode="time"
			@confirm="setEndTime"></u-picker>
		<xfTipModal ref="tipModal"></xfTipModal>
	</view>
</template>

<script>
	import {
		addJob,
		getFbEditInfo,
		getZfw,
		isCurrentPositionPaid
	} from "@/api/companyInterface/job.js"
	import {
		chooseLocal
	} from "@/libs/map.js"
	import jobType from "@/components/job/jobType/index.vue"
	import phoneSel from "@/components/company/phoneSel/index.vue"
	import selAreaMinxs from "@/utils/selArea.js"
	import {
		addJobTwo, getAgreement
	} from "@/api/economicInterface/user.js"
	import { isPayDeposit, validateSalary } from "@/api/common.js"
	export default {
		mixins: [selAreaMinxs],
		components: {
			jobType,
			phoneSel
		},
		data() {

			return {
				current: 0,
				showStartTime: false,
				showEndTime: false,
				showStartDate: false,
				showEndDate: false,
				jobId: "",
				jobNum: '',
				isFocus: false,
				companyId: '',
				averageSalary: 0,
				isCurrentPosition: false,
				formData: {
					id: "",
					"oddJobName": "",
					"oddJobType": "",
					"oddJobTypeText": "",
					"oddReleaseType": "",
					"oddReleaseTypeText": "",
					"oddJobUseNum": "",
					"workWay": "",
					"workWayText": "",
					contact: "",
					contactPhone: "",
					contactId: "",
					"izTools": "",
					"izToolsText": "",
					"oddJobDescribe": "",
					"workEnvironmentUrl": "",
					"jobBeginTime": "",
					"jobEndTime": "",
					"jobBeginDatetime": "",
					"jobEndDatetime": "",
					"longitude": "",
					"latitude": "",
					"hopeWorkAddress": "",
					"salary": "",
					"salaryPayment": "20",
					"salaryPaymentText": "日结",
					"izUrgent": null,
					"izUrgentText": null,
					"recruitmentCarefree": "",
					"recruitmentCarefreeText": "",
					// recruitmentCarefreeValue:[],
					"provinceId": null,
					"provinceName": null,
					"cityId": null,
					"cityName": null,
					"areaId": null,
					"areaName": null,
					"townId": null,
					"townName": null,
					"villageId": null,
					"villageName": null,
					address: ""
				},
				oddJobUseNumLis: [],
				izToolsLis: [],
				workWayLis: [],
				salaryPaymentLis: [],
				phoneLis: [],
				zzfwLis: [],
				rules: {
					oddJobTypeText: [{
						required: true,
						message: '招工类型不能为空',
						trigger: ['change', 'blur']
					}],
					oddJobName: [{
						required: true,
						message: '工作名称不能为空',
						trigger: ['change', 'blur']
					}],
					jobBeginTime: [{
						required: true,
						message: '用工开始日期不能为空',
						trigger: ['change', 'blur']
					}],
					address: [{
						required: true,
						message: '请输入详细工作地址',
						trigger: ['change', 'blur']
					}],
					jobEndTime: [{
						required: true,
						message: '用工结束日期不能为空',
						trigger: ['change', 'blur'],

					}, {
						trigger: ['change', 'blur'],
						validator: (rule, value, callback) => {
							var date1 = new Date(value);
							var date2 = new Date(this.formData.jobBeginTime);
							if (date1.getTime() < date2.getTime()) {
								callback(new Error('结束日期不能小于开始日期'));
							} else {
								callback();
							}

						}
					}],
					jobBeginDatetime: [{
						required: true,
						message: '用工开始时间不能为空',
						trigger: ['change', 'blur']
					}],
					jobEndDatetime: [{
						required: true,
						message: '用工结束时间不能为空',
						trigger: ['change', 'blur']
					}, {
						trigger: ['change', 'blur'],
						validator: (rule, value, callback) => {
							let date2 = this.formData.jobBeginDatetime
							const [hours1, minutes1] = value.split(':').map(Number);
							const [hours2, minutes2] = date2.split(':').map(Number);
							const totalMinutes1 = hours1 * 60 + minutes1;
							const totalMinutes2 = hours2 * 60 + minutes2;
							if (totalMinutes2 > totalMinutes1) {
								callback(new Error('结束时间不能小于开始时间'));
							} else {
								callback();
							}

						}
					}],
					salary: [{
						required: true,
						message: '薪资不能为空',
						trigger: ['change', 'blur']
					}],
					salaryPayment: [{
						required: true,
						message: '支付方式不能为空',
						trigger: ['change', 'blur']
					}],
					hopeWorkAddress: [{
						required: true,
						message: '工作地址不能为空',
						trigger: ['change', 'blur']
					}],
					contact: [{
						required: true,
						message: '联系人不能为空',
						trigger: ['change', 'blur']
					}],
					contactPhone: [{
						required: true,
						message: '联系电话不能为空',
						trigger: ['change', 'blur']
					}, {
						pattern: /^1[3456789]\d{9}$/,
						message: '手机号格式不正确',
						trigger: ['change', 'blur']
					}]
				},
				nextRules: {
					oddJobDescribe: [{
						required: true,
						message: '职位描述不能为空',
						trigger: ['change', 'blur']
					}],
					oddJobUseNum: [{
						required: true,
						message: '请选择招聘人数',
						trigger: ['change', 'blur']
					}, {
						pattern: /^[1-9]\d*$/,
						message: '招聘人数只能为正整数',
						trigger: ['change', 'blur']
					}],
					izTools: [{
						required: true,
						message: '请选择自带工具',
						trigger: ['change', 'blur']
					}],
					workWay: [{
						required: true,
						message: '请选择工作方式',
						trigger: ['change', 'blur']
					}]
				},
				agreement: '',
				wxSync: null
			}
		},
		onReady() {
			this.$refs.dataForm.setRules(this.rules);
			this.$refs.nextForm.setRules(this.nextRules);
		},
		async onShow() {
			this.wxSync = await this.xf.getIsShowPay();
			console.log(this.wxSync,'this.wxSync');
			

		},
		async onLoad(e) {
			const userInfo = JSON.parse(this.userStore.userInfo)
			this.formData.contact = userInfo.realName || ''
			this.formData.contactPhone = userInfo.userPhoneNo || ''
			this.jobId = e.id;
			this.companyId = e.companyId ? e.companyId : '';
			console.log(this.companyId)
			this.setDefaultTime()
			await this.getAgreementApi()
			await this.initDic()
			if (this.jobId) {
				this.isCurrentPositionPaidApi()
				this.getJobInfo()
			}
		},
		methods: {
			isCurrentPositionPaidApi(){
				isCurrentPositionPaid({
					infoid: this.jobId
				}).then(res => {
					const {result} = res
					this.isCurrentPosition = result		
				})
			},
			onblur(e, type) {
				// 检查输入是否为数字
				if (!isNaN(e) && e !== '') {
					let salary = Number(e).toFixed(2);
					// 确保薪资不低于10
					this.formData.salary = salary >= 0 ? salary : '0.00';
				} else {
					this.formData.salary = '';
				}
			},
			getAgreementApi() {
				getAgreement().then(res => {
					console.log(res,'res');
					if(res.result){
						this.agreement = res.result.content
					}
				})
			},
			checkZzfw(e, i) {
				console.log(this.zzfwLis)
			},
			focus() {
				this.formData.oddJobUseNum = "";
				this.isFocus = true;
				for (let i = 0; i < this.oddJobUseNumLis.length; i++) {
					this.oddJobUseNumLis[i].checked = false;
				}
			},
			inputNumber(e) {
				this.formData.oddJobUseNum = e;
			},
			initDic() {
				let arr = [{
					name: 'jjp_oddjob_salary_payment',
					v: 'salaryPaymentLis',
					text: 'salaryPayment'
				}, {
					name: 'jjp_oddjob_use_num',
					v: 'oddJobUseNumLis',
					text: 'oddJobUseNum'
				}, {
					name: 'jjp_oddjob_iz_tools',
					v: 'izToolsLis',
					text: 'izTools'
				}, {
					name: 'jjp_oddjob_work_way',
					v: 'workWayLis',
					text: 'workWay'
				}]

				for (let i = 0; i < arr.length; i++) {
					this.baseStore.getDictionaryDataAll(arr[i].name).then(res => {
						this[arr[i].v] = res.map((v, j) => {
							if (j == 0) {
								this.formData[arr[i].text] = v.value;
								this.formData[arr[i].text + 'Text'] = v.text;
							}
							return {
								...v,
								checked: j == 0 ? true : false
							}

						})
					})
				}
				getZfw().then(res => {
					this.zzfwLis = res.result.map(v => {
						return {
							...v,
							checked: false
						}
					});
				})

			},
			setDefaultTime() {
				let time = new Date()
				let d = this.xf.toDate(time, "yyyy-MM-dd")
				this.formData.jobBeginTime = d;
				this.formData.jobEndTime = d;
				this.formData.jobBeginDatetime = "09:00";
				this.formData.jobEndDatetime = "18:00"
				let info = uni.getStorageSync('')
			},
			openPhoenLink() {
				this.$refs.phoneSel.openPoup()
			},
			getConact(e) {
				if (e.value) {
					this.formData.contact = e.value.contactName;
					this.formData.contactPhone = e.value.contactPhone;
				} else {
					this.formData.contact = "";
					this.formData.contactPhone = "";
				}
			},
			getJobInfo() {
				getFbEditInfo({
					id: this.jobId
				}).then(res => {
					let info = res.result
					this.formData = {
						id: info.id,
						"oddJobName": info.oddJobName,
						"oddJobType": info.oddJobType,
						"oddJobTypeText": info.oddJobTypeText,
						"oddReleaseType": info.oddReleaseType,
						"oddReleaseTypeText": info.oddReleaseTypeText,
						"oddJobUseNum": info.oddJobUseNum.toString(),
						"workWay": info.workWay,
						"workWayText": info.workWayText,
						"salary": info?.salary.toString(),
						"salaryPayment": info.salaryPayment,
						"salaryPaymentText": info.salaryPaymentText,
						"izTools": info.izTools,
						"izToolsText": info.izToolsText,
						"oddJobDescribe": info.oddJobDescribe,
						"workEnvironmentUrl": info.workEnvironmentUrl,
						"jobBeginTime": info.jobBeginTime,
						"jobEndTime": info.jobEndTime,
						"jobBeginDatetime": info.jobBeginDatetime,
						"jobEndDatetime": info.jobEndDatetime,
						"longitude": info.longitude,
						"latitude": info.latitude,
						"hopeWorkAddress": info.hopeWorkAddress,
						contact: info.contact,
						contactPhone: info.contactPhone,
						contactId: info.contactId,
						"izMargin": info.izMargin,
						"izMarginText": info.izMarginText,
						"recruitmentCarefree": info.recruitmentCarefree,
						"recruitmentCarefreeText": info.recruitmentCarefreeText,
						"provinceId": info.provinceId,
						"provinceName": info.provinceName,
						"cityId": info.cityId,
						"cityName": info.cityName,
						"areaId": info.areaId,
						"areaName": info.areaName,
						"townId": info.townId,
						"townName": info.townName,
						"villageId": info.villageId,
						"villageName": info.villageName
					}
					// 获取平均薪资
					validateSalary({oddJobType: info.oddJobType}).then(res=>{
						// 平均薪资
						if(res.result){
							this.averageSalary = Number(res.result) 
						}
					})
					this.formData.address = this.formData.provinceName + this.formData.cityName + this.formData
						.areaName
					this.oddJobUseNumLis.map(v => {
						if (v.value == this.formData.oddJobUseNum) {
							v.checked = true;
						} else {
							v.checked = false;
						}
					})
					let jobNum = this.oddJobUseNumLis.find(v => v.checked == true)
					if (!jobNum) {
						this.jobNum = this.formData.oddJobUseNum;
						this.isFocus = true
					}
					this.izToolsLis.map(v => {
						if (v.value == this.formData.izTools) {
							v.checked = true;
						} else {
							v.checked = false;
						}
					})
					this.workWayLis.map(v => {
						if (v.value == this.formData.workWay) {
							v.checked = true;
						} else {
							v.checked = false;
						}
					})
					let d = this.formData.recruitmentCarefree.split(',');
					this.zzfwLis.map(v => {
						if (d.indexOf(v.code) >= 0) {
							v.checked = true;
						}
					})
					
				})
			},
			setStartDate(e) {

				this.formData.jobBeginTime = e.year + '-' + e.month + '-' + e.day;

			},
			setEndDate(e) {

				this.formData.jobEndTime = e.year + '-' + e.month + '-' + e.day;

			},
			setStartTime(e) {
				this.formData.jobBeginDatetime = e.hour + ':' + e.minute;
			},
			setEndTime(e) {
				this.formData.jobEndDatetime = e.hour + ':' + e.minute;
			},
			changeSettle(e, v) {
				this.formData.salaryPaymentText = v.text;
			},
			checkType(name, v, i) {
				if (name == "oddJobUseNum") {
					this.jobNum = ""
					this.isFocus = false;
				}
				this.formData[name] = v.value;
				this.formData[name + 'Text'] = v.text;
				this[name + 'Lis'].map((item, index) => {
					item.checked = index === i ? true : false
				})
			},
			nextStep() {
				if (this.current == 0) {
					this.$refs.dataForm.validate(valid => {
						if (valid) {

							this.current = this.current + 1;

						}
					})

				} else {
					this.current = this.current - 1;
				}

			},
			//打开全部职位选择框
			openJobType() {

				this.$refs.jobType.openPoup()
			},
			//选择位置信息
			async chooseLocation() {
				let res = await chooseLocal();
				let r = res.address + res.name;
				let d = this.regionDiscern(r)
				this.formData.provinceId = d.data.province.code;
				this.formData.cityId = d.data.city.code;
				this.formData.areaId = d.data.area.code;
				this.formData.provinceName = d.data.province.name;
				this.formData.cityName = d.data.city.name;
				this.formData.areaName = d.data.area.name;
				this.formData.address = this.formData.provinceName + this.formData.cityName + this.formData.areaName
				this.formData.latitude = res.latitude;
				this.formData.longitude = res.longitude;
				this.formData.hopeWorkAddress = d.data.address;
			},
			getSelV(e, v) {
				this.formData.oddJobType = e;
				this.formData.oddJobTypeText = v;
				this.formData.oddJobName = v
				validateSalary({oddJobType: e}).then(res=>{
					// 平均薪资
					if(res.result){
						this.averageSalary = Number(res.result) 
					}
				})
			},
			addPub() {
				let that = this;
				let jobInfo = this.xf.deepClone(this.formData);
				delete jobInfo.address;
				let t1 = [],
					t2 = [];
				this.zzfwLis.map(v => {
					if (v.checked == true) {
						t1.push(v.code)
						t2.push(v.pseudonym)
					}
				})
				jobInfo.recruitmentCarefree = t1.join(',');
				jobInfo.recruitmentCarefreeText = t2.join(',')
				jobInfo.izUrgent = t1.indexOf('20') >= 0 ? '1' : '0';
				jobInfo.izUrgentText = t1.indexOf('20') >= 0 ? '急聘' : '否';

				this.$refs.nextForm.validate(valid => {
					if (valid) {
						this.$refs.tipModal.open({
							content: "您确定发布该职位吗？",
							btnText: "发布",
							showCancel: true,
							success: function() {
								let func
								if (that.define.identification == 'units') {
									func = addJob
								} else {
									jobInfo.companyId = that.companyId;
									func = addJobTwo
								}
								func(jobInfo).then(res => {
									if(res){
										// 经纪人
										if(that.define.identification == 'broker'){
											setTimeout(() => {
												that.$refs.tipModal.open({
													content: "职位已发布给企业，请等待企业支付后发布成功",
													btnText: "确定",
													showCancel: false,
													success: function() {
														setTimeout(() => {
															uni.navigateBack()
														}, 1000)
														
													}
												})
											}, 300)
											
										} else {
											// 配置为false时，不需要支付
											if(!that.wxSync){
												const title = that.jobId ? "编辑成功!" : "发布成功!";
												that.xf.onlineUtils.toast(title, 2000)
												setTimeout(() => {
													uni.navigateBack()
												}, 2000)
												return
											} 
											// 编辑
											if(that.jobId) {
												isPayDeposit({
													oddJobId: that.jobId
												}).then(res=>{
													const {result} = res
													// 需要支付
													if(!result){
														uni.navigateTo({
															url: `/pages/common/pubJobPay/index?oddJobId=${that.jobId}`
														})
													} else {
														that.xf.onlineUtils.toast("编辑成功!", 2000)
														setTimeout(() => {
															uni.navigateBack()
														}, 2000)
													}
												})
											} else {
												uni.navigateTo({
													url: `/pages/common/pubJobPay/index?oddJobId=${res.result}`
												})
											}
										}
									}
								}).catch(err => {

								})
							}
						})
					}
				})

			}
		}
	}
</script>
<style lang="scss">
	page {

		min-height: 100%;
		background-color: #fff;
	}

	.inpuTBg .uicon-arrow-right {
		content: "\e600" !important;
	}
</style>
<style lang="scss" scoped>
	.inpuTBg {
		padding: 0 30rpx;
		height: 90rpx;
		background: #F8F8F8;
		border-radius: 20rpx 20rpx 20rpx 20rpx;
		display: flex;
		align-items: center;

	}

	.salaryInfo{
		color: #FF9C5A;
		font-size: 24rpx;
		margin-top: 24rpx;
		line-height: 43rpx;
	}
	.typeItem {
		width: calc(33% - 30rpx);
		height: 80rpx;
		line-height: 80rpx;
		border: 2rpx solid transparent;
		text-align: center;
		background: #F8F8F8;
		font-size: 28rpx;
		margin-bottom: 20rpx;
		border-radius: 20rpx;
		margin-right: 20rpx;

		&:nth-child(3n) {
			margin-right: 0;
		}

		&.checked {

			background: #EAF4FE;
			border-radius: 16rpx;

			/* #ifdef MP-COMPANY */
			color: #3291F8;
			border: 2px solid #3291F8;
			/* #endif */
			/* #ifdef MP-ECONOMIC */
			color: #00A0C6;
			border: 2px solid #00A0C6;

			/* #endif */
		}
		&.checked-disabled {
			background: #f8f8f8;
			border-radius: 16rpx;
			color: #999999;
			border: 1px solid #999999;
		}
	}

	.setalle {
		padding-top: 70rpx;
	}

	.wrapForm {
		.u-form-item {
			padding: 0 !important;
		}

		.rzCardBox {
			height: 128rpx;
			background: #F8F8F8;
			border-radius: 16rpx 16rpx 16rpx 16rpx;
			margin-top: 60rpx;

			&:last-child {
				margin-top: 30rpx;
			}

			.imgRzCard {
				width: 40rpx;
				height: 32rpx;
			}
		}

		padding-bottom: 240rpx;

		// height: 100%;

		.wrapFormBody {
			margin-top: -30rpx;
			border-radius: 40rpx 40rpx 0 0;
			background: #fff;
		}

		.uni-forms-item {
			align-items: center !important;
		}

		.uni-input-placeholder {
			// text-align: right !important;
			color: #BDBDBD !important;
		}
	}

	.bgLine {
		/* #ifdef MP-COMPANY */
		background-color: #EBF0FF;
		/* #endif */
		/* #ifdef MP-ECONOMIC */
		background-color: #EBFCFF;
		/* #endif */

		width: 100%;
		// height: 60rpx;
		padding: 30rpx 40rpx;

		.rzImg {
			width: 168rpx;
			height: 192rpx;
		}
	}


	.rightNowPay {
		width: 670rpx;
		height: 100rpx;
		line-height: 100rpx;

		border-radius: 30rpx;
		/* #ifdef MP-COMPANY */
		background: #3291F8;
		/* #endif */
		/* #ifdef MP-ECONOMIC */
		background: #00A0C6;
		/* #endif */

	}
</style>